
<?php
$menutype = "";
$menuname = "";
$menutitle = "";
$access ="";
$type = "";
$parentid = "";
$ordering = "";
$ishomepage ="";
$params ="";
if(!empty($menus)){
    $menutype = $this->_global->_unserialize($menus->menu_type);
    if(isset($menutype[$this->session->userdata('lan')]))
        $menutype = $menutype[$this->session->userdata('lan')]['menu_type'];
    $menuname = $this->_global->_unserialize($menus->menu_name);
    if(isset($menuname[$this->session->userdata('lan')]))
        $menuname = $menuname[$this->session->userdata('lan')]['menu_name'];
    $menutitle = $this->_global->_unserialize($menus->menu_title);
    if(isset($menutitle[$this->session->userdata('lan')]))
        $menutitle = $menutitle[$this->session->userdata('lan')]['menu_title'];
    $type = $this->_global->_unserialize($menus->type);
    if(isset($type[$this->session->userdata('lan')]))
        $type = $type[$this->session->userdata('lan')]['type'];
    $params = $this->_global->_unserialize($menus->params);
    if(!empty($menus->params)){
        if(isset($params[$this->session->userdata('lan')]))
        $params = $params[$this->session->userdata('lan')]['params'];
    }
    
    $access = $menus->access;
    $parentid = $menus ->parent_id;
    $ordering = $menus->ordering;
    $ishomepage = $menus->ishomepage;
    $menu_id = $menus->menu_id;
}
?>

<div class="" id="myModal" >
  <div class="modal-header">
    <h3 style="text-transform: capitalize;"><?php echo $action ?> Menu</h3>
  </div>
<?php echo form_open('administrator/menu/menus/save') ?>

    <label for="menu_title">Title:</label><input type="text" value="<?php echo $menutitle; ?>" name="menu_title" id="menu_title" />
    <label for="menu_name">Name</label><input type="text" value="<?php echo $menuname ?>" name="menu_name" id="menu_name" />
    <label for="menu_type">Menu Type</label><input type="text" value="<?php echo $menutype ?>" name="menu_type" id="menu_type" />
    <label for="type">Type</label><input type="text" value="<?php echo $type ?>" name="type" id="type" />
    <label for="parent">Parent</label>
            <select name="parent_id">
                <option value="0">None</option>
                <?php 
                if(count($menu_list)>0):?>
                    <?php foreach($menu_list as $menu):
                        $menu_title = $this->_global->_unserialize($menu->menu_title)
                    ?>
                        <option  <?php echo $menu->menu_id==$parentid?"selected='selected'":"" ?> value="<?php echo $menu->menu_id;?>"><?php echo $menu[$this->session->userdata('lan')]['menu_title'];?></option>
                    <?php endforeach?>
                <?php endif?>
            </select>
     <label for="access">Access:</label>
            <select name="access">
                <option value="0">All</option>
                <?php if(count($roles)>0):?>
                    <?php foreach($roles as $rol):?>
                        <option <?php echo $rol->rolesID==$access?"selected='selected'":"" ?> value="<?php echo $rol->rolesID;?>"><?php echo $rol->name;?></option>
                    <?php endforeach?>
                <?php endif?>
            </select>
     <label for="params">Params</label>
        <input type="text" name="params" id="params" value="<?php echo $params?>" />
     <label for="ordering">Ordering</label>
        <input type="text" name="ordering" id="ordering" value="<?php echo $ordering?>" />
     <label for="ishomepage">Set is home page</label>
        <select id="ishomepage">
            <option <?php echo $ishomepage=='1'?"selected='selected'":"" ?> value="1">Yes</option>
            <option <?php echo $ishomepage=='0'?"selected='selected'":"" ?> value="0">No</option>
        </select>
    <div class="modal-footer">
    <input type="submit" class="btn btn-primary"  value="Save"/>
    <a href="<?php echo base_url().'/administrator/menu/menus/'?>" class="btn">Cancel</a>
    <input type="hidden" name="action"  value="<?php echo $action ?>" id="action" />
    <input type="hidden" name="menu_id"  value="<?php echo $menu_id?>" id="menu_id" />
  </div> 
  </div>
</form>